package com.gg.admin.goods.contorller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;

import com.gg.admin.goods.service.GoodsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import helpers.baseservlet.BaseServlet;
import povos.Goods;


@WebServlet("/admin/AdminShowAllGoodsServlet")
public class AdminShowAllGoodsServlet extends BaseServlet {
	@Autowired
	private  GoodsService   goodsService;
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Integer  pageNum =   Integer.parseInt(request.getParameter("pageNum"));
		PageHelper.startPage(pageNum, 5);
		List<Goods>   goods =  goodsService.showAllHotGoods();
		PageInfo<Goods>   goodsinfo =  new PageInfo<Goods>(goods);
		request.getSession().setAttribute("goodsinfo", goodsinfo);
		
		response.sendRedirect("/fruits/BSindex4.jsp");
		//request.getRequestDispatcher("/BSindex4.jsp").forward(request, response);
	}
	
	

}
